/**
 * @file pid.h
 * @brief 
 * 
 * @author 1024Tech (店铺链接：https://1024tech.taobao.com/)
 * @version 1.0
 * @date 2023-06-08
 * 
 * @copyright Copyright (c) 2023  Open Robot Tech.co, Ltd
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2023-05-08 <td>1.0     <td>Mr.lin     <td>Release
 * </table>
 */

#ifndef _PID_H_
#define _PID_H_

#include "stdint.h"


typedef struct
{
    float err;
    float err_last;
    float expect;
    float feedback;
    float kp;
    float ki;
    float kd;
    float integral;
    float integral_max;
    float out;
    float out_max;
}_PID;

typedef struct
{
	_PID rol_encoder;   //编码器速度环	
	_PID rol_angle;     //姿态外环
	_PID rol_gyro;      //角速度环    


	_PID yaw_encoder;   //编码器速度环	
	_PID yaw_angle;     //姿态外环
	_PID yaw_gyro;      //角速度环   	

}_PID_TYPE;

extern _PID_TYPE pidType;

float pid_controller(_PID *controller , uint8_t err_lowpass);
void pid_init(void);
void clear_integral(_PID *controller);


#endif  /* _PID_H_ */

